package com.mousycoder.mysql.controller;
import java.time.LocalDateTime;

import com.google.common.collect.Lists;
import com.mousycoder.mysql.constant.RestItemResult;
import com.mousycoder.mysql.dao.UserDao;
import com.mousycoder.mysql.domain.User;
import com.mousycoder.mysql.model.Product;
import com.mousycoder.mysql.persist.mapper.custom.CustomUserMapper;
import com.mousycoder.mysql.persist.mapper.generated.ProductMapper;
import com.mousycoder.mysql.persist.mapper.generated.UserMapper;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * TODO
 *
 * @author mousycoder
 * @version 1.0
 * @date 2022/3/22 8:36 PM
 */
@RestController
@RequestMapping("/product")
public class ProductController {

    @Resource
    private ProductMapper productMapper;

    @RequestMapping("/query")
    private RestItemResult<Product> queryById() {
        RestItemResult<Product> userRestItemResult = new RestItemResult<>();
        return userRestItemResult;
    }

    @RequestMapping(value = "/add")
    private String add() {
        for (int i = 10000; i < 11000 ; i++) {
            Product product = new Product();
            product.setId((long)i);
            product.setSaleId("saleId"+i);
            product.setStoreId((long)i);
            product.setProductSeq("productSeq"+i);
            product.setSkuId("skuId"+i);
            product.setSpuId("spuId"+i);
            product.setValid(false);
            product.setCreateTime(LocalDateTime.now());
            product.setUpdateTime(LocalDateTime.now());
            productMapper.insertSelective(product);
        }
        return "success";
    }

}
